def setUp(self): super(ApplicationResourceTest, self).setUp() self.api_list_url = '/api/v1/applications/' self.container_list_url = '/api/v1/containers/' self.username = '******' self.password = '******' self.user = User.objects.create_user(self.username, '*****@*****.**', self.password) self.api_key = self.user.api_key.key self.app_data = { 'name': 'test-app', 'description': 'test app', 'domain_name': 'test.example.com', 'backend_port': 1234, 'protocol': 'http' } host = Host() host.name = 'local' host.hostname = os.getenv('DOCKER_TEST_HOST', '127.0.0.1') host.save() self.host = host self.container_data = { 'image': 'base', 'command': '/bin/bash', 'description': 'test app', 'ports': ['1234'], 'hosts': ['/api/v1/hosts/1/'] } resp = self.api_client.post(self.container_list_url, format='json', data=self.container_data, authentication=self.get_credentials()) self.app = Application(**self.app_data) self.app.save()
def setUp(self): super(ContainerResourceTest, self).setUp() self.api_list_url = '/api/v1/containers/' self.username = '******' self.password = '******' self.user = User.objects.create_user(self.username, '*****@*****.**', self.password) self.api_key = self.user.api_key.key host = Host() host.name = 'local' host.hostname = os.getenv('DOCKER_TEST_HOST', '127.0.0.1') host.save() self.host = host self.data = { 'image': 'base', 'command': '/bin/bash', 'description': 'test app', 'ports': [], 'hosts': ['/api/v1/hosts/1/'] } resp = self.api_client.post(self.api_list_url, format='json', data=self.data, authentication=self.get_credentials())