def test_distribution_exists(self):
        # Build a recipe.
        meta = self.write_meta('test_recipe_1', """
                    package:
                        name: test_recipe_1
                        version: 'determined_at_build_time'
                    build:
                        script: echo "v0.1.0.dev1" > __conda_version__.txt
                    """)
        meta = build(meta)

        # Check distribution exists returns false when there is no distribution.
        self.assertFalse(distribution_exists(CLIENT, OWNER, meta))

        # upload the distribution 
        upload(CLIENT, meta, OWNER, channels=['testing'])

        # Check the distribution exists. Notice there is no channel being supplied here.
        self.assertTrue(distribution_exists(CLIENT, OWNER, meta))

        # Check the distribution is on testing but not on main.
        self.assertTrue(distribution_exists_on_channel(CLIENT, OWNER, meta, channel='testing'))
        self.assertFalse(distribution_exists_on_channel(CLIENT, OWNER, meta, channel='main'))

        add_distribution_to_channel(CLIENT, OWNER, meta, channel='main')
        # Check that the distribution has been added.
        self.assertTrue(distribution_exists_on_channel(CLIENT, OWNER, meta, channel='main'))
    def test_distribution_exists(self):
        # Build a recipe.
        meta = self.write_meta(
            'test_recipe_1', """
                    package:
                        name: test_recipe_1
                        version: 'determined_at_build_time'
                    build:
                        script: echo "v0.1.0.dev1" > __conda_version__.txt
                    """)
        meta = build(meta)
        if hasattr(conda_build, 'api'):
            build_config = conda_build.api.Config()
        else:
            build_config = conda_build.config.config

        # Check distribution exists returns false when there is no distribution.
        self.assertFalse(distribution_exists(CLIENT, OWNER, meta))

        # upload the distribution
        upload(CLIENT, meta, OWNER, channels=['testing'], config=build_config)

        # Check the distribution exists. Notice there is no channel being supplied here.
        self.assertTrue(distribution_exists(CLIENT, OWNER, meta))

        # Check the distribution is on testing but not on main.
        self.assertTrue(
            distribution_exists_on_channel(CLIENT,
                                           OWNER,
                                           meta,
                                           channel='testing'))
        self.assertFalse(
            distribution_exists_on_channel(CLIENT, OWNER, meta,
                                           channel='main'))

        add_distribution_to_channel(CLIENT, OWNER, meta, channel='main')
        # Check that the distribution has been added.
        self.assertTrue(
            distribution_exists_on_channel(CLIENT, OWNER, meta,
                                           channel='main'))

        # Add the meta for a recipe known to exist on conda-forge
        meta2 = self.write_meta(
            'conda_build_all', """
                                package:
                                    name: conda-build-all
                                    version: 0.12.0
                                """)
        copy_distribution_to_owner(CLIENT,
                                   'conda-forge',
                                   OWNER,
                                   meta2,
                                   channel='main')
        self.assertTrue(distribution_exists_on_channel(CLIENT, OWNER, meta2))
    def test_distribution_exists(self):
        # Build a recipe.
        meta = self.write_meta('test_recipe_1', """
                    package:
                        name: test_recipe_1
                        version: 'determined_at_build_time'
                    build:
                        script: echo "v0.1.0.dev1" > __conda_version__.txt
                    """)
        meta = build(meta)
        if hasattr(conda_build, 'api'):
            build_config = conda_build.api.Config()
        else:
            build_config = conda_build.config.config

        # Check distribution exists returns false when there is no distribution.
        self.assertFalse(distribution_exists(CLIENT, OWNER, meta))

        # upload the distribution 
        upload(CLIENT, meta, OWNER, channels=['testing'], config=build_config)

        # Check the distribution exists. Notice there is no channel being supplied here.
        self.assertTrue(distribution_exists(CLIENT, OWNER, meta))

        # Check the distribution is on testing but not on main.
        self.assertTrue(distribution_exists_on_channel(CLIENT, OWNER, meta, channel='testing'))
        self.assertFalse(distribution_exists_on_channel(CLIENT, OWNER, meta, channel='main'))

        add_distribution_to_channel(CLIENT, OWNER, meta, channel='main')
        # Check that the distribution has been added.
        self.assertTrue(distribution_exists_on_channel(CLIENT, OWNER, meta, channel='main'))

        # Add the meta for a recipe known to exist on conda-forge
        meta2 = self.write_meta('conda_build_all', """
                                package:
                                    name: conda-build-all
                                    version: 0.12.0
                                """)
        copy_distribution_to_owner(CLIENT, 'conda-forge', OWNER, meta2, channel='main')
        self.assertTrue(distribution_exists_on_channel(CLIENT, OWNER, meta2))
    def test_distribution_exists(self):
        # Build a recipe.
        meta = self.write_meta(
            'test_recipe_1', """
                    package:
                        name: test_recipe_1
                        version: 'determined_at_build_time'
                    build:
                        script: echo "v0.1.0.dev1" > __conda_version__.txt
                    """)
        meta = build(meta)

        # Check distribution exists returns false when there is no distribution.
        self.assertFalse(distribution_exists(CLIENT, OWNER, meta))

        # upload the distribution
        upload(CLIENT, meta, OWNER, channels=['testing'])

        # Check the distribution exists. Notice there is no channel being supplied here.
        self.assertTrue(distribution_exists(CLIENT, OWNER, meta))

        # Check the distribution is on testing but not on main.
        self.assertTrue(
            distribution_exists_on_channel(CLIENT,
                                           OWNER,
                                           meta,
                                           channel='testing'))
        self.assertFalse(
            distribution_exists_on_channel(CLIENT, OWNER, meta,
                                           channel='main'))

        add_distribution_to_channel(CLIENT, OWNER, meta, channel='main')
        # Check that the distribution has been added.
        self.assertTrue(
            distribution_exists_on_channel(CLIENT, OWNER, meta,
                                           channel='main'))