Exemple #1
0
 def test_make_name_includes_prefix_and_separator(self):
     self.assertThat(factory.make_name("abc"), StartsWith("abc-"))
 def test_compose_preseed_for_commissioning_node_has_header(self):
     node = factory.make_node(status=NODE_STATUS.COMMISSIONING)
     self.assertThat(compose_preseed(node), StartsWith("#cloud-config\n"))
Exemple #3
0
    def test_print_module_named_with_dashes_help_for_valid_plugin(self):
        result = self.run_command(["help", "plainbox-provider", "--base", "core18"])

        expected = "Displaying help for the 'plainbox-provider' plugin for 'core18'."
        self.assertThat(result.output, StartsWith(expected))
Exemple #4
0
 def setUp(self):
     super(TestContextMenuImageAndLink, self).setUp(path="/imagelink")
     self.assertThat(self.menu.get_title_label().text,
                     StartsWith(self.data_uri_prefix))
    def test_get_png_from_rgba_file_returns_png_file(self):
        with _single_pixel_rgba_data_file() as filepath:
            png_image_data = _ss._get_png_from_rgba_file(filepath, (1, 1))

            self.assertEqual(0, png_image_data.tell())
            self.assertThat(png_image_data.read(), StartsWith(b'\x89PNG\r\n'))
Exemple #6
0
 def test_mismatch_returns_does_not_start_with(self):
     matcher = StartsWith("bar")
     self.assertIsInstance(matcher.match("foo"), DoesNotStartWith)
Exemple #7
0
 def test_mismatch_sets_expected(self):
     matcher = StartsWith("bar")
     mismatch = matcher.match("foo")
     self.assertEqual("bar", mismatch.expected)
Exemple #8
0
 def test_makeDistribution_created_name_starts_with_distribution(self):
     distribution = self.factory.makeDistribution()
     self.assertThat(distribution.name, StartsWith("distribution"))
Exemple #9
0
 def test_makeDistribution_created_display_name_starts_Distribution(self):
     distribution = self.factory.makeDistribution()
     self.assertThat(distribution.displayname, StartsWith("Distribution"))
Exemple #10
0
 def test_bootloader_path_does_not_include_tftp_root(self):
     tftproot = self.make_tftp_root()
     method = S390XBootMethod()
     self.assertThat(method.bootloader_path, Not(StartsWith(tftproot.path)))
Exemple #11
0
    def test_uses_prefix(self):
        prefix = factory.make_string(3)
        with tempdir(prefix=prefix) as directory:
            pass

        self.assertThat(os.path.basename(directory), StartsWith(prefix))
Exemple #12
0
 def test_compose_config_path_does_not_include_tftp_root(self):
     tftproot = self.make_tftp_root().asBytesMode()
     mac = factory.make_mac_address("-")
     self.assertThat(compose_config_path(mac),
                     Not(StartsWith(tftproot.path)))
Exemple #13
0
 def test_make_name_does_not_require_prefix(self):
     size = randint(1, 99)
     unprefixed_name = factory.make_name(sep="-", size=size)
     self.assertEqual(size, len(unprefixed_name))
     self.assertThat(unprefixed_name, Not(StartsWith("-")))
Exemple #14
0
 def test_make_name_uses_configurable_separator(self):
     sep = "SEPARATOR"
     prefix = factory.make_string(3)
     self.assertThat(factory.make_name(prefix, sep=sep),
                     StartsWith(prefix + sep))
Exemple #15
0
 def test_str_with_unicode(self):
     u = _u("\xA7")
     matcher = StartsWith(u)
     self.assertEqual("StartsWith(%r)" % (u, ), str(matcher))
Exemple #16
0
 def test_makeDistroSeries_created_name_starts_with_distroseries(self):
     distroseries = self.factory.makeDistroSeries()
     self.assertThat(distroseries.name, StartsWith("distroseries"))
Exemple #17
0
 def test_match(self):
     matcher = StartsWith("bar")
     self.assertIs(None, matcher.match("barf"))
Exemple #18
0
 def test_makeDistroSeries_created_display_name_starts_Distroseries(self):
     distroseries = self.factory.makeDistroSeries()
     self.assertThat(distroseries.displayname, StartsWith("Distroseries"))
Exemple #19
0
 def test_mismatch_sets_matchee(self):
     matcher = StartsWith("bar")
     mismatch = matcher.match("foo")
     self.assertEqual("foo", mismatch.matchee)
Exemple #20
0
 def test_compose_enlistment_preseed_url_returns_absolute_link(self):
     url = 'http://%s' % factory.make_name('host')
     self.patch(settings, 'DEFAULT_MAAS_URL', url)
     self.assertThat(compose_enlistment_preseed_url(), StartsWith(url))
Exemple #21
0
    def test_print_module_named_with_dashes_help_for_valid_plugin(self):
        result = self.run_command(["help", "plainbox-provider"])

        expected = " Create parts"
        self.assertThat(result.output, StartsWith(expected))
Exemple #22
0
 def test_compose_preseed_url_returns_absolute_link(self):
     self.assertThat(compose_preseed_url(factory.make_node()),
                     StartsWith('http://'))
Exemple #23
0
    def test_error(self):
        soname_cache = elf.SonameCache()
        raised = self.assertRaises(EnvironmentError, soname_cache.__setitem__,
                                   self.key, '/soname.so')

        self.assertThat(str(raised), StartsWith(self.partial_message))
Exemple #24
0
 def test_returns_absolute_path(self):
     self.set_root(".")
     self.patch(provisioningserver.path, "makedirs")
     self.assertThat(self.get_path_function(), StartsWith("/"))
     self.assertEqual(getcwd(), self.get_path_function())
 def test_take_screenshot_filepath_is_in_tmp_dir(self):
     with patch.object(_ss.subprocess, 'check_call'):
         self.assertThat(_ss._take_mirscreencast_screenshot(),
                         StartsWith(tempfile.gettempdir()))
Exemple #26
0
 def test_str(self):
     matcher = StartsWith("bar")
     self.assertEqual("StartsWith('bar')", str(matcher))
 def test_under_dir(self):
     root = self.useFixture(TempDir()).path
     fixture = TempDir(root)
     fixture.setUp()
     with fixture:
         self.assertThat(fixture.path, StartsWith(root))
Exemple #28
0
 def test_str_with_bytes(self):
     b = _b("\xA7")
     matcher = StartsWith(b)
     self.assertEqual("StartsWith(%r)" % (b, ), str(matcher))
Exemple #29
0
 def test_get_time_string_ends_with_suffix(self):
     now = time.time()
     self.assertThat(get_time_string(now), StartsWith(key_prefix))
Exemple #30
0
 def setUp(self):
     super(TestContextMenuImageAndLinkOverlayWebView, self).setUp()
     self._setup_overlay_webview_context_menu("imagelink")
     self.assertThat(self.menu.get_title_label().text,
                     StartsWith(self.data_uri_prefix))