예제 #1
0
    def test_enqueues_task(self):
        """Ensures a task is enqueued."""
        key = instance_templates.get_instance_template_revision_key(
            'base-name', 'revision')
        models.InstanceTemplate(key=key.parent(), active=key).put()
        models.InstanceTemplateRevision(key=key).put()
        expected_url = key.urlsafe()

        instance_templates.schedule_creation()

        self.assertEqual(key.get().url, expected_url)
  def test_enqueues_task(self):
    """Ensures a task is enqueued."""
    key = instance_templates.get_instance_template_revision_key(
        'base-name', 'revision')
    models.InstanceTemplate(key=key.parent(), active=key).put()
    models.InstanceTemplateRevision(key=key).put()
    expected_url = key.urlsafe()

    instance_templates.schedule_creation()

    self.assertEqual(key.get().url, expected_url)
예제 #3
0
    def test_enqueues_tasks(self):
        """Ensures tasks are enqueued."""
        # Instance template should be created for key1.
        key1 = instance_templates.get_instance_template_revision_key(
            'base-name-1', 'revision')
        models.InstanceTemplate(key=key1.parent(), active=key1).put()
        models.InstanceTemplateRevision(key=key1).put()
        # key2 refers to an inactive instance template revision. No instance
        # template should be created.
        key2 = instance_templates.get_instance_template_revision_key(
            'base-name-2', 'revision')
        models.InstanceTemplate(key=key2.parent()).put()
        models.InstanceTemplateRevision(key=key2).put()
        # key3 refers to a drained instance template revision. No instance
        # template should be created.
        key3 = instance_templates.get_instance_template_revision_key(
            'base-name-3', 'revision')
        models.InstanceTemplate(key=key3.parent(), drained=[key3]).put()
        models.InstanceTemplateRevision(key=key3).put()
        # key4 refers to an active instance template revision that does not
        # exist. No instance template should be created.
        key4 = instance_templates.get_instance_template_revision_key(
            'base-name-4', 'revision')
        models.InstanceTemplate(key=key4.parent(), active=key4).put()
        # Instance template should be created for key5.
        key5 = instance_templates.get_instance_template_revision_key(
            'base-name-5', 'revision')
        models.InstanceTemplate(key=key5.parent(), active=key5).put()
        models.InstanceTemplateRevision(key=key5).put()

        instance_templates.schedule_creation()

        self.assertEqual(key1.get().url, key1.urlsafe())
        self.failIf(key2.get().url)
        self.failIf(key3.get().url)
        self.failIf(key4.get())
        self.assertEqual(key5.get().url, key5.urlsafe())
  def test_enqueues_tasks(self):
    """Ensures tasks are enqueued."""
    # Instance template should be created for key1.
    key1 = instance_templates.get_instance_template_revision_key(
        'base-name-1', 'revision')
    models.InstanceTemplate(key=key1.parent(), active=key1).put()
    models.InstanceTemplateRevision(key=key1).put()
    # key2 refers to an inactive instance template revision. No instance
    # template should be created.
    key2 = instance_templates.get_instance_template_revision_key(
        'base-name-2', 'revision')
    models.InstanceTemplate(key=key2.parent()).put()
    models.InstanceTemplateRevision(key=key2).put()
    # key3 refers to a drained instance template revision. No instance
    # template should be created.
    key3 = instance_templates.get_instance_template_revision_key(
        'base-name-3', 'revision')
    models.InstanceTemplate(key=key3.parent(), drained=[key3]).put()
    models.InstanceTemplateRevision(key=key3).put()
    # key4 refers to an active instance template revision that does not
    # exist. No instance template should be created.
    key4 = instance_templates.get_instance_template_revision_key(
        'base-name-4', 'revision')
    models.InstanceTemplate(key=key4.parent(), active=key4).put()
    # Instance template should be created for key5.
    key5 = instance_templates.get_instance_template_revision_key(
        'base-name-5', 'revision')
    models.InstanceTemplate(key=key5.parent(), active=key5).put()
    models.InstanceTemplateRevision(key=key5).put()

    instance_templates.schedule_creation()

    self.assertEqual(key1.get().url, key1.urlsafe())
    self.failIf(key2.get().url)
    self.failIf(key3.get().url)
    self.failIf(key4.get())
    self.assertEqual(key5.get().url, key5.urlsafe())
예제 #5
0
 def get(self):
     instance_templates.schedule_creation()
예제 #6
0
 def get(self):
   instance_templates.schedule_creation()