package com.atlassian.bitbucket.internal.mirroring.mirror.rest.cloud;

import com.atlassian.bitbucket.internal.mirroring.mirror.rest.MirrorJsonEntity;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

@RunWith(MockitoJUnitRunner.class)
public class RestCloudExternalProjectTest {
    @Rule
    public MirrorJsonEntity json = new MirrorJsonEntity("cloud/json/project.json");

    @Test
    public void testBasicDetails() throws Exception {
        RestCloudExternalProject project = new RestCloudExternalProject(json.getValue());

        assertEquals("{899b158f-cf7f-44f1-8ade-ea7c3bdc3db3}", project.getId());
        assertEquals("Mars Project", project.getName());
        assertEquals("MARS", project.getKey());
        // the json has is_private = false but cloud projects must always be considered private or else the mirror will
        // grant public access to private repos owing to the server permission model
        assertFalse(project.isPublic());
    }
}
