def test_mismatch_sets_matchee(self): matcher = EndsWith("bar") mismatch = matcher.match("foo") self.assertEqual("foo", mismatch.matchee)
def test_mismatch_sets_expected(self): matcher = EndsWith("bar") mismatch = matcher.match("foo") self.assertEqual("bar", mismatch.expected)
def test_match(self): matcher = EndsWith("arf") self.assertIs(None, matcher.match("barf"))
def test_mismatch_returns_does_not_end_with(self): matcher = EndsWith("bar") self.assertIsInstance(matcher.match("foo"), DoesNotEndWith)
def test_generate_omapi_key_returns_a_key(self): key = generate_omapi_key() # Could test for != None here, but the keys end in == for a 512 # bit length key, so that's a better check that the script was # actually run and produced output. self.assertThat(key, EndsWith("=="))
def test_str(self): matcher = EndsWith("bar") self.assertEqual("Ends with 'bar'.", str(matcher))
def test_uses_suffix(self): suffix = factory.make_string(3) with tempdir(suffix=suffix) as directory: pass self.assertThat(os.path.basename(directory), EndsWith(suffix))
def test_encode_multipart_data_closes_with_closing_boundary_line(self): data = {'foo': make_string().encode('ascii')} files = {'bar': BytesIO(make_string().encode('ascii'))} body, headers = encode_multipart_data(data, files) self.assertThat(body, EndsWith(b'--'))
def test_custom_section_ends_with_newline(self): self.assertThat(write_custom_config_section("x", "y"), EndsWith('\n'))