def test_that_when_checking_if_a_domain_exists_and_a_domain_exists_the_domain_exists_method_returns_true(self): ''' Tests checking domain existence when the domain already exists ''' result = boto_elasticsearch_domain.exists(DomainName='testdomain', **conn_parameters) self.assertTrue(result['exists'])
def test_that_when_checking_if_a_domain_exists_and_boto3_returns_an_error_the_domain_exists_method_returns_error(self): ''' Tests checking domain existence when boto returns an error ''' self.conn.describe_elasticsearch_domain.side_effect = ClientError(error_content, 'list_domains') result = boto_elasticsearch_domain.exists(DomainName='mydomain', **conn_parameters) self.assertEqual(result.get('error', {}).get('message'), error_message.format('list_domains'))
def test_that_when_checking_if_a_domain_exists_and_a_domain_does_not_exist_the_domain_exists_method_returns_false(self): ''' Tests checking domain existence when the domain does not exist ''' self.conn.describe_elasticsearch_domain.side_effect = not_found_error result = boto_elasticsearch_domain.exists(DomainName='mydomain', **conn_parameters) self.assertFalse(result['exists'])
def test_that_when_checking_if_a_domain_exists_and_a_domain_exists_the_domain_exists_method_returns_true( self, ): """ Tests checking domain existence when the domain already exists """ result = boto_elasticsearch_domain.exists(DomainName="testdomain", **conn_parameters) self.assertTrue(result["exists"])
def test_that_when_checking_if_a_domain_exists_and_a_domain_does_not_exist_the_domain_exists_method_returns_false( self, ): """ Tests checking domain existence when the domain does not exist """ self.conn.describe_elasticsearch_domain.side_effect = not_found_error result = boto_elasticsearch_domain.exists(DomainName="mydomain", **conn_parameters) assert not result["exists"]
def test_that_when_checking_if_a_domain_exists_and_boto3_returns_an_error_the_domain_exists_method_returns_error( self, ): """ Tests checking domain existence when boto returns an error """ self.conn.describe_elasticsearch_domain.side_effect = ClientError( error_content, "list_domains") result = boto_elasticsearch_domain.exists(DomainName="mydomain", **conn_parameters) assert result.get( "error", {}).get("message") == error_message.format("list_domains")