class NginxConfigTankTestCase(BaseTestCase): def setup_method(self, method): super(NginxConfigTankTestCase, self).setup_method(method) context.nginx_configs = None self.nginx_configs = NginxConfigTank() def teardown_method(self, method): self.nginx_configs = None context.nginx_configs = NginxConfigTank() super(NginxConfigTankTestCase, self).teardown_method(method) def test_init(self): assert_that(self.nginx_configs, not_none()) def test_len(self): assert_that(self.nginx_configs, has_length(0)) def test_keys(self): assert_that(self.nginx_configs.keys(), not_none()) assert_that(self.nginx_configs.keys(), has_length(0)) self.nginx_configs[('/etc/nginx/nginx.conf', '/usr/share/nginx', '/usr/sbin/nginx')] assert_that(self.nginx_configs.keys(), has_length(1)) assert_that( self.nginx_configs.keys(), equal_to([('/etc/nginx/nginx.conf', '/usr/share/nginx', '/usr/sbin/nginx')])) def test_get(self): assert_that(self.nginx_configs, has_length(0)) config = self.nginx_configs[('/etc/nginx/nginx.conf', '/usr/share/nginx', '/usr/sbin/nginx')] assert_that(config, not_none()) assert_that(config, instance_of(NginxConfig)) assert_that(self.nginx_configs, has_length(1)) def test_del(self): assert_that(self.nginx_configs, has_length(0)) config = self.nginx_configs[('/etc/nginx/nginx.conf', '/usr/share/nginx', '/usr/sbin/nginx')] assert_that(config, not_none()) assert_that(config, instance_of(NginxConfig)) assert_that(self.nginx_configs, has_length(1)) del self.nginx_configs[('/etc/nginx/nginx.conf', '/usr/share/nginx', '/usr/sbin/nginx')] assert_that(self.nginx_configs, has_length(0))
def _setup_nginx_config_tank(self): from amplify.agent.tanks.nginx_config import NginxConfigTank self.nginx_configs = NginxConfigTank()
def teardown_method(self, method): # rejuvanate context for future tests context.nginx_configs = None context.nginx_configs = NginxConfigTank() super(NginxConfigTankCleanTestCase, self).teardown_method(method)
def setup_method(self, method): super(NginxConfigTankCleanTestCase, self).setup_method(method) # rejuvanate context for this test in case it was polluted before context.nginx_configs = None context.nginx_configs = NginxConfigTank()
def teardown_method(self, method): self.nginx_configs = None context.nginx_configs = NginxConfigTank() super(NginxConfigTankTestCase, self).teardown_method(method)
def setup_method(self, method): super(NginxConfigTankTestCase, self).setup_method(method) context.nginx_configs = None self.nginx_configs = NginxConfigTank()